package demo1;

class Shape {
    public void draw() {
        System.out.println("画图形");
    }
}
class Flower extends Shape {
    @Override
    public void draw() {
        System.out.println("✿！");
    }
}
class Rect extends Shape {
    @Override
    public void draw() {
        System.out.println("◇！");
    }
}
class  Cycle extends Shape {
    @Override
    public void draw() {
        System.out.println("○！");
    }
}
public class Test {

    public static void drowShapes() {
        Shape[] shapes = {new Cycle() ,new Rect(),new Cycle(),new Rect(),new Flower()};
        for (Shape shape : shapes) {
            shape.draw();
        }
    }

    public static void main2(String[] args) {
        drowShapes();
    }

    public static void drawMap(Shape shape) {
        shape.draw();
    }
    public static void main1(String[] args) {


        Flower flower = new Flower();
        drawMap(flower);

        Rect rect = new Rect();
        drawMap(rect);

        /*Cycle cycle = new Cycle();
        drawMap(cycle);*/
        drawMap(new Cycle());
    }
}

